package logic.courseQuery_logic;

import java.util.LinkedList;
import java.util.List;

import javaRMI.RMIClient;
import logic.utility_logic.CourseProduceLogicsvFactory;
import logicsv.courseProduce_logicsv.CourseProduceLogicsv;
import po.TeaCouRecPO;
import resultmessage.CourseQueryRM;
import vo.CourseVO;
import datasv.courseQuery_datasv.CourseQueryDatasv;
import datasv.datafactorysv.CourseQueryDatasvFactory;

public class TeaCouList {
	private CourseQueryDatasv courseQD ;
	private CourseProduceLogicsv coursePL;
	public TeaCouList(RMIClient rmi){
		 courseQD = new CourseQueryDatasvFactory(rmi).create();
		 coursePL = new CourseProduceLogicsvFactory(rmi).create();
	}
	public List<CourseVO> getAllCouOfTea(String teacherID){
		LinkedList<CourseVO> courseList = new LinkedList<CourseVO>();
		List<TeaCouRecPO> list = courseQD.getAllCouOfTea(teacherID);
		if(list != null){
			for(TeaCouRecPO rec : list){
				courseList.add(coursePL.getCourse(rec.getCourseID()));
			}
		}
		return courseList;
	}
	public CourseQueryRM deleteCouOfTea(String courseID, String teacherID) {
		return courseQD.deleteCouOfTea(courseID, teacherID);
	}

	public CourseQueryRM addCouOfTea(String courseID, String teacherID) {
		return courseQD.addCouOfTea(courseID, teacherID);
	}
}
